package ${ftl_jpa_package};

import ${ftl_domain_package}.${className};
import com.base.web.common.BaseRepository;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

//import javax.persistence.LockModeType;
//import org.springframework.data.domain.Page;
//import org.springframework.data.domain.Pageable;
//import org.springframework.data.jpa.repository.Lock;
//import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Repository：${tableInfo.table_comment?if_exists}.
 * @author ${ftl_author}
 * @since ${ftl_now}
 * @version ${ftl_version}
 */
public interface ${className}Repository extends BaseRepository<${className}, ${idType}> {

    /**
     * 根据编号查询单个对象
     */
    @Query("select * from ${className} where ${idFiled} = ?1")
    // @Query("select * from ${tableName} where ${idColumn} = ?1")
    ${className} findOne(${idType} id);

    /**
     * 根据编号列表查询对象列表
     * @param ids 编号列表（逻辑主键）
     */
    @Query("select * from ${className} where ${idFiled} in (?1)")
    // @Query("select * from ${tableName} where ${idColumn} in (?1)")
    public List<${className}> findList(List<${idType}> ids);

    /**
     * 根据编号逻辑删除
     * @param id （逻辑主键）
     */
    // @Transactional
    @Modifying
    @Query("delete from ${className} where ${idFiled} = ?1 ")
    // @Query("delete from ${tableName} where ${idColumn} = ?1 ")
    public void delete(${idType} id);
}
